package com.ie.cloud.payment.task;
import com.ie.cloud.payment.service.impl.PayOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.time.LocalDate;

/**
 * Created with FR
 *
 * @Author: DQ
 * @Date: 2025/07/22/10:13
 * @Description: 订单支付成功任务
 */
@Component
@Slf4j
public class PayOrderPaySuccessTask implements CommandLineRunner {

    @Resource
    private PayOrderService payOrderService;

    @Scheduled(cron = "0 0/10 * * * ?")
    public void start()
    {
        log.info("订单明细查询 更改 订单状态启动");
        LocalDate trxDate = LocalDate.now();

        payOrderService.updateToSuccessOrder(trxDate.toString());

        log.info("订单明细查询 更改 订单状态结束");

    }


    @Override
    public void run(String... args) {
        start();
    }
}
